package com.cainiao.controller;

import javafx.geometry.Pos;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author shkstart
 * @create 2021-08-06 19:45
 */
@Controller
public class UserController {

    /**
     * 使用 RESTFul 模拟用户资源的增删改查
     * /users    get       查询所有用户信息
     * /user/1   get     根据用户id查询用户信息
     * /user     post      添加用户信息
     * /user/1   delete    删除用户信息
     * /user     put       修改用户信息
     *
     * @return
     */
    @RequestMapping(value = "/user", method = RequestMethod.GET)
    public String getAllUser() {
        System.out.println("查询所有用户信息");
        return "success";
    }

    @RequestMapping(value = "/user/{id}", method = RequestMethod.GET)
    public String getUserById() {
        System.out.println("根据id查询用户信息");
        return "success";
    }

    @RequestMapping(value = "/user", method = RequestMethod.POST)
    public String insertUser(String username, String password) {
        System.out.println("添加用户信息：" + username + "," + password);
        return "success";
    }

    @RequestMapping(value = "/user", method = RequestMethod.PUT)
    public String updatetUser(String username, String password) {
        System.out.println("修改用户信息：" + username + "," + password);
        return "success";
    }


}
